package SST.LIB;

import java.util.*;

/** 
 Comm ��ժҪ˵����
*/
public class Comm
{

	//public static 
	public Comm()
	{
		//
		// TODO: �ڴ˴���ӹ��캯���߼�
		//
	}

	public static int GetUid()
	{
		return MOLE.GetValue.GetCookieInt("hy_num");
	}

	public static ArrayList GetBillIdes(int agentid, int dataid)
	{
		String sql = "select * from agentdg where agent_id=" + String.valueOf(agentid) + " and data_id=" + String.valueOf(dataid);
		System.Data.DataTable dt = MOLE.SQL.GetDataTable(sql);
		ArrayList a = new ArrayList();
		for (int i = 0;i < dt.Rows.size();i++)
		{
			a.add(MOLE.str.ConverToInt(dt.Rows[i]["adid"].toString(), 0));
		}
		return a;

	}


	public static int GetBillDataId(int billid)
	{
		String sql = "select * from agentdg where adid=" + String.valueOf(billid);
		System.Data.DataTable dt = MOLE.SQL.GetDataTable(sql);

		if (dt.Rows.size() == 0)
		{
			return 0;
		}
		else
		{
			return Integer.parseInt(dt.Rows[0]["data_id"].toString().trim());
		}
	}

	public static String GetFormatTeuzhu(String s)
	{
		return s.replace("|",",").replace("@"," | ");

	}

	public static String GetFormatTeuzhu(Object s)
	{
		return GetFormatTeuzhu(s.toString());

	}

	public static String GetPlayStr(Object s)
	{
		return s.toString().replace("ʱʱ��","");

	}

	public static String GetTermBingoNumber(Object s)
	{
		String ss = s.toString().trim();
		try
		{

			ss = (new MOLE.Bill.Term(ss)).BingoNumber.toString();
		}
		catch (java.lang.Exception e)
		{
			ss = "";
		}
		if (ss.equals(""))
		{
			ss = "����";
		}
		return ss;

	}



	public static DataTable GetTeuzhuRecord(int uid, String status, String startTime, String EndTime)
	{

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		String sql = " select  top 1000000 *    from  daigou ";
		if (uid == 0)
		{
			sql = sql + " where 1=1 ";
		}
		else
		{
			sql += " where agent_id=" + String.valueOf(uid);
		}

		if (status.equals("") || status.equals("���м�¼"))
		{
			sql += " and 1=1";
		}
		else
		{
			if (status.equals("���н�"))
			{
				sql += " and zj_jiangjin>0  ";
			}
			else
			{
				sql += "  and zt='" + status + "' ";
			}
		}


		if (startTime.equals(""))
		{
			sql += " and 1=1";
		}
		else
		{
			sql += "  and addtime >= '" + startTime + " 00:00:00'";
		}

		if (EndTime.equals(""))
		{
			sql += " and 1=1";
		}
		else
		{
			sql += "  and addtime<='" + EndTime + " 23:59:59'";
		}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion

		sql += " order by  id desc";
		DataTable d = MOLE.SQL.GetDataTable(sql);


		return d;

	}



}